/*
package com.itheima.sh.esdemo.controller;

import com.itheima.sh.esdemo.pojo.Sku;
import com.itheima.sh.esdemo.pojo.User;
import com.itheima.sh.esdemo.service.SkuService;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

*/
/**
 * @Name: xiaoxiao
 * @Version: 1.0.0
 * @Date: 2020/11/23_21:45
 * @Description:
 *//*

@Controller
public class SkuController {
    @Autowired
    SkuService skuService;

    private RestHighLevelClient client;
    @Before
    public void init(){
        //创建Rest客户端
        client = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("192.168.200.150",9200,"http")
                )
        );
    }

    //批量添加
    @Test
    public void testBulkAddDocumentList(){

        //从数据库查询
        List<Sku> list = skuService.findAll();
        //

        //遍历查到数据库的每一条数据
        for (Sku sku : list) {
            System.out.println("sku = " + sku);
        }
    }


    //关闭客户端连接
    @After
    public void close()throws Exception{
        client.close();
    }

}
*/
